/* 
 * 
 */

function verificaHashTag(component) {
    var posicaoInicial = 0;
    var caracteres = component.split(" ");
    document.getElementById("destaque").innerHTML = "";
    for (var i = 0; i < caracteres.length; i++) {
        if (caracteres[i].substring(0, 1).search("#") != -1) {
            document.getElementById("destaque").innerHTML =
                    document.getElementById("destaque").innerHTML +
                    " <a onclick = \"pesquisaHashTag('" + caracteres[i] + "');\">" + caracteres[i] + "</a>";
        }
    }
}

function pesquisaHashTag(str)
{
    if (str.length == 0)
    {
        document.getElementById("principal").innerHTML = "";
        return;
    }
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function()
    {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
        {
            document.getElementById("principal").innerHTML = xmlhttp.responseText;
        }
    }
    str = retiraCaractere(str,"#");
    xmlhttp.open("GET", '../controller/consultahash.php?q='+str, true);
    xmlhttp.send();
}